#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++) 
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

using ll = long long;
using db = double;
using pii = pair < int , int >;
using vec = vector < int >;
using veg = vector < pii >;

int read() {
	int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-', ch = getchar(); 
	while(isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar(); return f ? -x : x;
}

const int N = 2010;
const ll inf = 1e18;

int n, m, K, nxt[N], t1[N], t2[N], s[N], t[N], tot;
ll f[2][N][2], ans;
struct peo { int x, id, tp; } al[N << 1];

int main() {
#ifndef ONLINE_JUDGE
	freopen("1.in", "r", stdin);
#endif
	n = in, m = in, K = in; rep(i, 1, n) s[i] = in, t[i] = in, al[++tot] = { s[i], i, 0 }, al[++tot] = { t[i], i, 1 };
	sort(al + 1, al + tot + 1, [](auto x, auto y) { return x.x < y.x; });
	ans = al[1].x + m - al[tot].x;
	rep(i, 1, tot - 1) {
		auto x = al[i], y = al[i + 1]; int l = y.x - x.x; 
		if(x.tp == 0 && y.tp == 0) t1[x.id] += l;
		else if(x.tp == 1 && y.tp == 0) ans += l;
		else if(x.tp == 0 && y.tp == 1) { if(x.id == y.id) t1[x.id] += l; else nxt[x.id] = y.id, t2[y.id] += l; }
		else t1[y.id] += l;
	}
	int p = 0;
	rep(i, 1, n) if(!t2[i]) { nxt[p] = i; while(nxt[p]) p = nxt[p]; }
	memset(f[0], 0xcf, sizeof f[0]); f[0][0][0] = ans; int o = 0; 
	for(int x = nxt[0]; x; x = nxt[x], o ^= 1) {
		memset(f[o ^ 1], 0xcf, sizeof f[o ^ 1]);
		rep(i, 0, K) {
			rep(j, 0, 1) {
				if(f[o][i][j] >= 0) {
					f[o ^ 1][i][0] = max(f[o ^ 1][i][0], f[o][i][j]);
					if(i < K) f[o ^ 1][i + 1][1] = max(f[o ^ 1][i + 1][1], f[o][i][j] + (j ? t2[x] : 0) + t1[x]);
				}
			}
		}
	}
	printf("%lld\n", max(f[o][K][0], f[o][K][1]));
	return 0;
}
